var b = {
    name: 'aa'
  }
  function a(e, ee) {
    console.log(this.name);
    return e + ee
  }
  // a.apply(b, [1, 2])
  
  Function.prototype.myapply = function(context) {
    if (typeof this !== 'function') {
      throw new TypeError('Error')
    }
  
    context = context || window
    // const args = [...arguments].slice(1)
    context.fn = this
    let result = context.fn(...arguments[1])
    delete context.fn
    return result
  }
  
  a.myapply(b, [1, 2])
  